home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_10_sea_alarm.cog < prev    next >
Text File  |  1999-11-15  |  9KB  |  336 lines

  1. # Jones 3D Cog Script
  2. #
  3. # 10_SEA_Alarm.cog
  4. #
  5. # Guard warns Volodnikov that Jones has escaped
  6. #
  7. # [HB]
  8. #
  9. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  10. #
  11. # ==============================================================================
  12.  
  13. symbols
  14.  
  15. # .................................. MESSAGES ..................................
  16.  
  17.     message        startup
  18.     message        activated
  19.     message        arrived
  20.     message        callback
  21.     message        user4 # to note player has weapons    
  22.     
  23. # .................................. KEYFRAMES .................................
  24.     
  25.     keyframe    vo_armsATback=vo_stand2_arms_back.key    local
  26.     keyframe    vo_glasses=0vo_alarmglasses_2_2.key        local
  27.     keyframe    vo_leftup3=0vo_leftup_3_3.key            local
  28.     keyframe    vo_bothup=0vo_bothup_3_3.key            local
  29.         
  30. # .................................. MODELS ....................................
  31.  
  32.     model          mod_vo_head=head_vo_noglasses.3do        local
  33.     model          mod_vo_glasses=hand_vo_glasses.3do        local
  34.  
  35. # .................................. SOUNDS ....................................
  36.  
  37.     sound        sl_jonesescaped=Se05r01.wav                local
  38.     sound        vo_retakehim=Se05v02.wav                local
  39.     sound        sl_understood=Se05r03.wav                local
  40.  
  41.     sound        dr_open=sea_doors_open_c.wav            local
  42.     sound        dr_close=sea_doors_close_c.wav            local
  43.  
  44. #    sound        music0=mus_gen_russremin2.wav            local
  45.     
  46. # ............................... ACTOR THINGS .................................
  47.  
  48.     thing        bowdoorswitch
  49.     thing        bowdoor
  50.     thing        player                                    local
  51.     thing        alarm_sailor                            nolink
  52.     thing        alarm_volod                                nolink
  53.      
  54. # .............................. OBJECT THINGS .................................
  55.  
  56.     thing        alarm_door                                nolink
  57.     thing        alarm_desk                                nolink
  58.     thing        alarm_lamp                                nolink
  59.  
  60. # .............................. CAMERA THINGS .................................
  61.  
  62.     thing        alarm_cam_1                                nolink
  63.         
  64.     thing        alarm_ct_1                                nolink
  65.     thing        alarm_ct_2                                nolink
  66.  
  67.     
  68. # .............................. TARGET THINGS .................................
  69.  
  70.     thing        alarm_mk_1                                nolink
  71.     thing        alarm_mk_2                                nolink
  72.  
  73. # ........................ OTHER ENGINE REFERENCES .............................
  74.  
  75.     cog            bowdoorcog
  76.     
  77.     # sector        startsector
  78.  
  79. # ............................... VARIABLES ....................................
  80.     
  81.     flex        sl_rotRate                                local
  82.     flex        sl_headRate                                local
  83.     flex        vo_rotRate                                local
  84.     flex        vo_headRate                                local
  85.  
  86.     flex        duration=1.5                            local
  87.  
  88.     int            cutSceneState=0                            local
  89.     int            gotweapons=0                            local
  90.  
  91.     int            vo_keyTrack1                            local
  92.     int            vo_keyTrack2
  93.  
  94.     int            vo_swapitem1                            local
  95.     int            vo_swapitem2                            local
  96.  
  97.     int            cursound                                local
  98.     int            curcam                                    local
  99.  
  100.     int            sl_colltype                                local
  101.  
  102.     int            callbackNum                                local
  103.  
  104. # .............................. SUBROUTINES ...................................
  105.  
  106.     flex        opendoor                                local
  107.     flex        closedoor                                local
  108.     flex        entersailor                                local
  109.     
  110. end
  111.  
  112. # ==============================================================================
  113.  
  114. code
  115.  
  116. # ..............................................................................
  117.  
  118. startup:
  119.  
  120.     # Prepare for much later...
  121.     SetThingFlags(alarm_sailor, 0x80000);
  122.     SetThingFlags(alarm_volod, 0x80000);
  123.     cutSceneState = 0;
  124.  
  125.     return;
  126.  
  127. # ..............................................................................
  128.  
  129. user4:
  130.  
  131.     # stop cutscene until player has retrieved his weapons...
  132.     gotweapons = 1;
  133.     return;
  134.  
  135. # ..............................................................................
  136.  
  137. activated:
  138.  
  139.     if (gotweapons == 0)
  140.     {
  141.         # No cutscene until player has his weapons...
  142.         return;
  143.     }
  144.     
  145.     if (GetSenderRef() != bowdoorswitch)
  146.     {
  147.         # Must be triggered by correct switch...
  148.         return;
  149.     }
  150.  
  151.     if (cutSceneState != 0)
  152.     {
  153.         # Only run cutscene once...
  154.         return;
  155.     }
  156.  
  157.     # Prep engine...
  158.     cutSceneState = 1;
  159.     player = GetLocalPlayerThing();
  160.     MakeMeStop();
  161.     StartCutScene(1);
  162.  
  163.     SendMessage(bowdoorcog, user5); # keep bow door open
  164.  
  165.     # Wait for the bowdoor to fully open...
  166.  
  167.     return;
  168.  
  169. # ..............................................................................
  170.  
  171. arrived:
  172.  
  173.     if (GetSenderRef() != bowdoor)
  174.     {
  175.         # Continue only when bowdoor is fully open...
  176.         return;
  177.     }
  178.  
  179.     if (cutSceneState != 1)
  180.     {
  181.         # Only respond on first fully open arrival...
  182.         return;
  183.     }
  184.     
  185.     # Prep...
  186.     cutSceneState = 2;
  187.     ClearThingFlags(alarm_volod, 0x80000);
  188.     ClearThingFlags(alarm_sailor, 0x80000);
  189.     sl_colltype = GetCollideType(alarm_sailor);
  190.     sl_rotRate = GetThingMaxRotVel(alarm_sailor);
  191.     sl_headRate = GetThingMaxHeadVel(alarm_sailor);
  192.     vo_rotRate = GetThingMaxRotVel(alarm_volod);
  193.     vo_headRate = GetThingMaxHeadVel(alarm_volod);
  194.     AISetCutSceneMode(alarm_volod);
  195.     AISetCutSceneMode(alarm_sailor);
  196.  
  197.     # Volodnikov starts to clean his glasses...
  198.     CaptureThing(alarm_volod);
  199.     vo_keyTrack1 = PlayKey(alarm_volod, vo_armsATback, 2, 0x10, 0);
  200.     PlayKey(alarm_volod, vo_glasses, 4, 0x12, 0); # RT: Triggers callbacks
  201.  
  202.     # Cut to shot of Volodnikov...
  203.     curcam = GetCurrentCamera();
  204.     SetCameraLookInterp(2, 0);
  205.     SetCameraPosInterp(2, 0);
  206.     SetCameraFocus(2, alarm_cam_1);
  207.     SetCameraSecondaryFocus(2, alarm_ct_1);
  208.     SetCurrentCamera(2);
  209.     SetCameraFOV(55, 0, 0.0);
  210.     
  211.     # Maybe a touch of melodramatic music...
  212.     # PlaySoundLocal(music0, 0.8, 0.0, 0x0, 0);    
  213.  
  214. # ..............................................................................
  215.  
  216. callback:
  217.  
  218.     if (GetSenderRef() != alarm_volod) return;
  219.  
  220.     callbackNum = GetParam(1);
  221.  
  222.     if (callbackNum == 21)
  223.     {
  224.         # Volodnikov removes his glasses...
  225.         vo_swapitem1 = SetThingMesh(alarm_volod, 2, mod_vo_head, 0); # no glasses head
  226.         vo_swapitem2 = SetThingMesh(alarm_volod, 8, mod_vo_glasses, 0); # hand with glasses
  227.     }
  228.     else if (callbackNum == 22)
  229.     {
  230.         # Volodnikov replaces his glasses...
  231.         RestoreThingMesh(alarm_volod, vo_swapitem1);
  232.         RestoreThingMesh(alarm_volod, vo_swapitem2);
  233.  
  234.         Call opendoor;
  235.         Call entersailor;
  236.     }
  237.  
  238.     return;
  239.  
  240. # ..............................................................................
  241.  
  242. opendoor:
  243.  
  244.     Rotate(alarm_door, -90, 1, duration);
  245.     PlaySoundThing(dr_open, alarm_door, 1, 5, 10, 0);
  246.     return;
  247.  
  248. # ..............................................................................
  249.  
  250. closedoor:
  251.  
  252.     Rotate(alarm_door, 90, 1, duration);
  253.     Sleep(0.5);
  254.     PlaySoundThing(dr_close, alarm_door, 1, 5, 10, 0);
  255.     return;
  256.  
  257. # ..............................................................................
  258.  
  259. entersailor:
  260.  
  261.     # The door opens and a sailor enters...
  262.     SetCollideType(alarm_sailor, 0);
  263.     SetCollideType(alarm_volod, 0);
  264.     SetThingFlags(alarm_desk, 0x80000);
  265.     SetThingFlags(alarm_lamp, 0x80000);
  266.     AISetMoveSpeed(alarm_sailor, 0.9);
  267.     AISetLookThingEyeLevel(alarm_sailor, alarm_mk_1);
  268.     AISetMoveThing(alarm_sailor, alarm_mk_1, 0);
  269.     AISetLookThingEyeLevel(alarm_sailor, alarm_volod);
  270.     StopKey(alarm_volod, vo_keyTrack1, 0.5);
  271.     StopKey(alarm_volod, vo_keyTrack2, 0.5);
  272.     Sleep(0.2);
  273.  
  274.     # Volodnikov turns to face sailor...
  275.     SetThingMaxHeadVel(alarm_volod, 120.0);
  276.     SetThingMaxRotVel(alarm_volod, 100.0);
  277.     AIEnableBodyTracking(alarm_volod, alarm_sailor);
  278.     
  279.     # Re-frame toward door...
  280.     SetCameraLookInterp(2, 1);
  281.     # SetCameraPosInterp(2, 1);
  282.     SetCameraInterpSpeed(2, 1.0);
  283.     Sleep(0.01);
  284.     MoveToFrame(alarm_cam_1, 1, 0.5);
  285.     SetCameraSecondaryFocus(2, alarm_ct_2);
  286.     Sleep(1.0);
  287.  
  288.     # Sailor: "Comrade! Jones has escaped!"
  289.     cursound = PlayVoice(alarm_sailor, sl_jonesescaped, 1.0, 0);
  290.     AIWaitForStop(alarm_sailor);
  291.     WaitForSound(cursound);
  292.  
  293.     # Volodnikov: "What?! Retake him immediately...alive...dead..."
  294.     AIDisableBodyTracking(alarm_volod);
  295.     cursound = PlayVoice(alarm_volod, vo_retakehim, 1.0, 0);
  296.     Sleep(0.5);
  297.     PlayKey(alarm_volod, vo_leftup3, 4, 0x12, 1);
  298.     Sleep(0.8);
  299.     PlayKey(alarm_volod, vo_bothup, 4, 0x12, 0);
  300.     WaitForSound(cursound);
  301.  
  302.     # Sailor: "Understood, sir!"
  303.     cursound = PlayVoice(alarm_sailor, sl_understood, 1.0, 0);
  304.  
  305.     # Sailor exits...
  306.     AISetLookThingEyeLevel(alarm_sailor, alarm_mk_2);
  307.     Sleep(0.5);
  308.     AISetMoveThing(alarm_sailor, alarm_mk_2, 0);
  309.     Sleep(1.0);
  310.  
  311.     # Door closes...
  312.     Call closedoor;
  313.     Sleep(2.0);
  314.  
  315.     # Clean up...
  316.     SetCameraLookInterp(2, 0);
  317.     SetCameraPosInterp(2, 0);
  318.     RestoreExtCam();
  319.     SetCurrentCamera(curcam);
  320.     ResetCameraFOV(0, 0.0);
  321.     DestroyThing(alarm_sailor);
  322.     DestroyThing(alarm_volod);
  323.     ClearThingFlags(alarm_desk, 0x80000);
  324.     ClearThingFlags(alarm_lamp, 0x80000);
  325.  
  326.     # Restore control...
  327.     EndCutScene();
  328.     ClearActorFlags(player, 0x200000);
  329.  
  330.     Sleep(4.0);
  331.     SendMessage(bowdoorcog, user6); # allow bow door to close
  332.  
  333.     return;
  334.  
  335. end
  336.